<template>
        <el-col :span="4">
            <h5>欢迎你,{{userName}}</h5>
            <el-menu
                    default-active="1"
                    class="el-menu-vertical-demo"
                    background-color="#545c64"
                    text-color="#fff"
                    active-text-color="#ffd04b"
                    @select="findUser"
            >
                <el-menu-item index="1">
                    <i class="el-icon-menu"></i>
                    <span slot="title">主页</span>
                </el-menu-item>
                <el-submenu index="2">
                    <template slot="title">
                        <i class="el-icon-location"></i>
                        <span>公共信息</span>
                    </template>
                    <el-menu-item-group>
                        <el-menu-item index="2-1">选项1</el-menu-item>
                        <el-menu-item index="2-2">选项2</el-menu-item>
                        <el-menu-item index="2-3">选项3</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
                <el-submenu index="3">
                    <template slot="title">
                        <i class="el-icon-location"></i>
                        <span>办公业务</span>
                    </template>
                    <el-menu-item-group>
                        <el-menu-item index="3-1">保单操作</el-menu-item>
                        <el-menu-item index="3-2">保单维护</el-menu-item>
                        <el-menu-item index="3-3">险种管理</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
                <el-submenu index="4">
                    <template slot="title">
                        <i class="el-icon-location"></i>
                        <span>系统管理</span>
                    </template>
                    <el-menu-item-group>
                        <el-menu-item index="4-1">日志管理</el-menu-item>
                        <el-menu-item index="4-2">部门管理</el-menu-item>
                        <el-menu-item index="4-3">报表查看</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
                <el-submenu index="5">
                    <template slot="title">
                        <i class="el-icon-location"></i>
                        <span>个人信息管理</span>
                    </template>
                    <el-menu-item-group>
                        <el-menu-item index="5-1">客户管理</el-menu-item>
                        <el-menu-item index="5-2">个人签单查询</el-menu-item>
                        <el-menu-item index="5-3">个人信息修改</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
            </el-menu>
        </el-col>
</template>

<script>
    export default {
        name: "NavMenu",
        data(){
            return{
                userName:this.$store.state.userName,
            }

        },
        methods:{
            findUser(index){
                if (index==1){
                    this.$router.push("Home")//路由到指定位置
                }
                if (index=='3-1'){
                    this.$router.push("WarrantyOperation")
                }
                if (index=='3-2'){
                    this.$router.push("WarrantyMaintain")
                }
                if (index=='3-3'){
                    this.$router.push("InsuranceManage")
                }
                if (index=='4-1'){
                    this.$router.push("LogManage")
                }
                if (index=='4-2'){
                    this.$router.push("DeptManage")
                }
                if (index=='4-3'){
                    this.$router.push("reportForm")
                }
                if (index=='5-1'){
                    this.$router.push("ClientManage")
                }
                if (index=='5-2'){
                    this.$router.push("userWarrantyQuery")
                }
                if (index=='5-3'){
                    this.$router.push("userInfoChange")
                }

            }

        }
    }
</script>

<style scoped>

</style>